pp108 : createXml Method

createXml Method


This method creates a new XML document in the local store with a specific name and adds it to the Local_Store_Index.

Syntax


bSuccess = object.createXml(sName, oXmlDocument [, dExpirationDate]);

Parameters

Parameter

Description

sName

Required. String that will be used as the name of the XML document created.

oXmlDocument

Required. XML that will form the content of the new document created in the local store.

dExpirationDate

Optional. Date till which the XML document will be saved in the local store.


Return Value


Returns one of the following possible values.

true

XML document has been successfully created in the local store and also added to the Local_Store_Index.

false

XML document has not been created.


Remarks


This method internally invokes the saveXml() method which saves the document in the local store and the addToIndex() method which adds the root node of the saved document to the Local_Store_Indexfile.

When the expiration date is not mentioned in the parameter list this method saves the document forever.

Example


The following example shows how to create an XML document in the local store.

var oTimeNow = new Date();
oTimeNow.setDate(oTimeNow.getDate() + parseInt(expiryDurationValue));
var sExpirationDate = oTimeNow.toUTCString();
//oPersist is the Id of the buslocalstore object
oPersist.createXml("myData", xmlData.XMLDocument.documentElement, sExpirationDate);

See Also


buslocalstore